API: remove gtk_paint_polygon()
authorBenjamin Otte <otte@redhat.com>
Wed, 14 Jul 2010 17:13:59 +0000 (19:13 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 10 Aug 2010 19:02:27 +0000 (21:02 +0200)
Almost noone uses it in real applications and it's broken in most theme
engines.

docs/reference/gtk/gtk3-sections.txt
gtk/gtk.symbols
gtk/gtkstyle.c
gtk/gtkstyle.h

index 10e4651311c2b9ecb71915bb8c8419af7e705ca1..f49104edd157e163f75b6e11b28d1435c617b629 100644 (file)
@@ -5221,7 +5221,6 @@ gtk_paint_focus
 gtk_paint_handle
 gtk_paint_hline
 gtk_paint_option
-gtk_paint_polygon
 gtk_paint_shadow
 gtk_paint_shadow_gap
 gtk_paint_slider
index 3ca319bd2f9c9054248a96d1f9c684c5dcf95e84..15fe9e6732a2b584c9344c14be5bc99317972633 100644 (file)
@@ -1021,7 +1021,6 @@ gtk_paint_handle
 gtk_paint_hline
 gtk_paint_layout
 gtk_paint_option
-gtk_paint_polygon
 gtk_paint_resize_grip
 gtk_paint_shadow
 gtk_paint_shadow_gap
index ac3e80ebba00c2d566cf35f2849e08d66289f3e1..471e85ec191eb1140b5b7207fba3f252897d2c3b 100644 (file)
@@ -129,16 +129,6 @@ static void gtk_default_draw_shadow     (GtkStyle        *style,
                                         gint             y,
                                         gint             width,
                                         gint             height);
-static void gtk_default_draw_polygon    (GtkStyle        *style,
-                                        GdkWindow       *window,
-                                        GtkStateType     state_type,
-                                        GtkShadowType    shadow_type,
-                                        GdkRectangle    *area,
-                                        GtkWidget       *widget,
-                                        const gchar     *detail,
-                                        GdkPoint        *points,
-                                        gint             npoints,
-                                        gboolean         fill);
 static void gtk_default_draw_arrow      (GtkStyle        *style,
                                         GdkWindow       *window,
                                         GtkStateType     state_type,
@@ -511,7 +501,6 @@ gtk_style_class_init (GtkStyleClass *klass)
   klass->draw_hline = gtk_default_draw_hline;
   klass->draw_vline = gtk_default_draw_vline;
   klass->draw_shadow = gtk_default_draw_shadow;
-  klass->draw_polygon = gtk_default_draw_polygon;
   klass->draw_arrow = gtk_default_draw_arrow;
   klass->draw_diamond = gtk_default_draw_diamond;
   klass->draw_box = gtk_default_draw_box;
@@ -2326,136 +2315,6 @@ gtk_default_draw_shadow (GtkStyle      *style,
   cairo_destroy (cr);
 }
 
-static void
-gtk_default_draw_polygon (GtkStyle      *style,
-                          GdkWindow     *window,
-                          GtkStateType   state_type,
-                          GtkShadowType  shadow_type,
-                          GdkRectangle  *area,
-                          GtkWidget     *widget,
-                          const gchar   *detail,
-                          GdkPoint      *points,
-                          gint           npoints,
-                          gboolean       fill)
-{
-  static const gdouble pi_over_4 = G_PI_4;
-  static const gdouble pi_3_over_4 = G_PI_4 * 3;
-  GdkGC *gc1;
-  GdkGC *gc2;
-  GdkGC *gc3;
-  GdkGC *gc4;
-  gdouble angle;
-  gint xadjust;
-  gint yadjust;
-  gint i;
-  
-  switch (shadow_type)
-    {
-    case GTK_SHADOW_IN:
-      gc1 = style->bg_gc[state_type];
-      gc2 = style->dark_gc[state_type];
-      gc3 = style->light_gc[state_type];
-      gc4 = style->black_gc;
-      break;
-    case GTK_SHADOW_ETCHED_IN:
-      gc1 = style->light_gc[state_type];
-      gc2 = style->dark_gc[state_type];
-      gc3 = style->dark_gc[state_type];
-      gc4 = style->light_gc[state_type];
-      break;
-    case GTK_SHADOW_OUT:
-      gc1 = style->dark_gc[state_type];
-      gc2 = style->light_gc[state_type];
-      gc3 = style->black_gc;
-      gc4 = style->bg_gc[state_type];
-      break;
-    case GTK_SHADOW_ETCHED_OUT:
-      gc1 = style->dark_gc[state_type];
-      gc2 = style->light_gc[state_type];
-      gc3 = style->light_gc[state_type];
-      gc4 = style->dark_gc[state_type];
-      break;
-    default:
-      return;
-    }
-  
-  if (area)
-    {
-      gdk_gc_set_clip_rectangle (gc1, area);
-      gdk_gc_set_clip_rectangle (gc2, area);
-      gdk_gc_set_clip_rectangle (gc3, area);
-      gdk_gc_set_clip_rectangle (gc4, area);
-    }
-  
-  if (fill)
-    gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
-  
-  npoints--;
-  
-  for (i = 0; i < npoints; i++)
-    {
-      if ((points[i].x == points[i+1].x) &&
-          (points[i].y == points[i+1].y))
-        {
-          angle = 0;
-        }
-      else
-        {
-          angle = atan2 (points[i+1].y - points[i].y,
-                         points[i+1].x - points[i].x);
-        }
-      
-      if ((angle > -pi_3_over_4) && (angle < pi_over_4))
-        {
-          if (angle > -pi_over_4)
-            {
-              xadjust = 0;
-              yadjust = 1;
-            }
-          else
-            {
-              xadjust = 1;
-              yadjust = 0;
-            }
-          
-          gdk_draw_line (window, gc1,
-                         points[i].x-xadjust, points[i].y-yadjust,
-                         points[i+1].x-xadjust, points[i+1].y-yadjust);
-          gdk_draw_line (window, gc3,
-                         points[i].x, points[i].y,
-                         points[i+1].x, points[i+1].y);
-        }
-      else
-        {
-          if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
-            {
-              xadjust = 0;
-              yadjust = 1;
-            }
-          else
-            {
-              xadjust = 1;
-              yadjust = 0;
-            }
-          
-          gdk_draw_line (window, gc4,
-                         points[i].x+xadjust, points[i].y+yadjust,
-                         points[i+1].x+xadjust, points[i+1].y+yadjust);
-          gdk_draw_line (window, gc2,
-                         points[i].x, points[i].y,
-                         points[i+1].x, points[i+1].y);
-        }
-    }
-
-  if (area)
-    {
-      gdk_gc_set_clip_rectangle (gc1, NULL);
-      gdk_gc_set_clip_rectangle (gc2, NULL);
-      gdk_gc_set_clip_rectangle (gc3, NULL);
-      gdk_gc_set_clip_rectangle (gc4, NULL);
-    }
-}
-
 static void
 draw_arrow (cairo_t       *cr,
            GdkColor      *color,
@@ -5119,43 +4978,6 @@ gtk_paint_shadow (GtkStyle           *style,
                                             x, y, width, height);
 }
 
-/**
- * gtk_paint_polygon:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @area: (allow-none): clip rectangle, or %NULL if the
- *        output should not be clipped
- * @widget: (allow-none): the widget
- * @detail: (allow-none): a style detail
- * @points: an array of #GdkPoint<!-- -->s
- * @n_points: length of @points
- * @fill: %TRUE if the polygon should be filled
- *
- * Draws a polygon on @window with the given parameters.
- */ 
-void
-gtk_paint_polygon (GtkStyle           *style,
-                   GdkWindow          *window,
-                   GtkStateType        state_type,
-                   GtkShadowType       shadow_type,
-                   const GdkRectangle *area,
-                   GtkWidget          *widget,
-                   const gchar        *detail,
-                   const GdkPoint     *points,
-                   gint                n_points,
-                   gboolean            fill)
-{
-  g_return_if_fail (GTK_IS_STYLE (style));
-  g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
-  g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
-  GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type,
-                                             (GdkRectangle *) area, widget, detail,
-                                             (GdkPoint *) points, n_points, fill);
-}
-
 /**
  * gtk_paint_arrow:
  * @style: a #GtkStyle
index debd77b05468ed3907107248383502ccca5f75e2..fffdff931faecc42fcaa7b9c0b8a03056aa835ee 100644 (file)
@@ -205,16 +205,6 @@ struct _GtkStyleClass
                                 gint                    y,
                                 gint                    width,
                                 gint                    height);
-  void (*draw_polygon)         (GtkStyle               *style,
-                                GdkWindow              *window,
-                                GtkStateType            state_type,
-                                GtkShadowType           shadow_type,
-                                GdkRectangle           *area,
-                                GtkWidget              *widget,
-                                const gchar            *detail,
-                                GdkPoint               *point,
-                                gint                    npoints,
-                                gboolean                fill);
   void (*draw_arrow)           (GtkStyle               *style,
                                 GdkWindow              *window,
                                 GtkStateType            state_type,
@@ -505,16 +495,6 @@ void gtk_paint_shadow      (GtkStyle           *style,
                            gint                y,
                            gint                width,
                            gint                height);
-void gtk_paint_polygon     (GtkStyle           *style,
-                           GdkWindow          *window,
-                           GtkStateType        state_type,
-                           GtkShadowType       shadow_type,
-                           const GdkRectangle *area,
-                           GtkWidget          *widget,
-                           const gchar        *detail,
-                           const GdkPoint     *points,
-                           gint                n_points,
-                           gboolean            fill);
 void gtk_paint_arrow       (GtkStyle           *style,
                            GdkWindow          *window,
                            GtkStateType        state_type,